﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using xplang.run;
using xplang.abstractions;
using System.Diagnostics;

namespace xplang.statements
{
  [DebuggerDisplay("break")]
  public class Break : Statement
  {
    public override Value doIt(Value[] heap, ref FlowState state)
    {
      state = FlowState.ExitFromBlock;
      return null;
    }

    public override bool isBlock()
    {
      return false;
    }
    //public override void save(Scope scope, SourceBuilder target)
    //{
    //    target.write("return");
    //    if (expression != null)
    //    {
    //        target.write(" ");
    //        expression.save(scope,target);
    //    }
    //    target.writeln(";");
    //}

    //public override void toCSharp(Scope scope, SourceBuilder target)
    //{
    //    target.write("return");
    //    if (expression != null)
    //    {
    //        target.write(" ");
    //        expression.toCSharp(scope, target);
    //    }
    //    target.writeln(";");
    //}

    //public override void toJavaScript(Scope scope, SourceBuilder target)
    //{
    //    target.write("return");
    //    if (expression != null)
    //    {
    //        target.write(" ");
    //        expression.toCSharp(scope, target);
    //    }
    //    target.writeln(";");
    //}
  }
}
